home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Meeting Pearls 1
/
Meeting Pearls Vol 1 (1994).iso
/
amok98-106
/
amok105
/
hotkey
/
hotkeytest.mod
< prev
next >
Wrap
Text File
|
1994-05-03
|
2KB
|
70 lines
(*---------------------------------------------------------------------------
:Program. HotKeyTest
:Author. Thomas Igracki
:Address. Obstallee 45, 1000 Berlin 20, W-Germany
:E-Mail. T.IGRACKI@BAMP.ZER
:Version. V1.0 28-Apr-92 Thomas Igracki erste Veröffentlichung
:Version. V2.0 21-Dec-92 [tom] angepaßt an HotKey.mod V2.0
:Copyright. Thomas Igracki
:Language. Oberon
:Translator. Amiga Oberon 3.00d
:Contents. TestProgramm für das HotKey Modul.
:Usage. [Run] TestHotKey
:Remark. Needs OS2.04 or higher!
---------------------------------------------------------------------------*)
MODULE HotKeyTest;
IMPORT
s: SYSTEM,
c: Commodities,
d: Dos,
e: Exec,
hot: HotKey,
io;
CONST
ID1 = 0; ID2 = -5;
VAR
ls : LONGSET;
HotSig : SHORTINT;
ID : LONGINT;
Type : LONGSET;
BEGIN
IF ~hot.CheckCVersion(0) THEN HALT(20) END;
HotSig := hot.InitX ('HotKeyTest','Commodity Test','A test of the HotKey-Modul',{hot.notify,hot.unique},TRUE,10);
IF HotSig = -1 THEN
io.WriteString ('Init() failed error code: ');
io.WriteInt(hot.Error,0);
io.WriteLn;
HALT(20);
END;
IF ~hot.AddKey ("alt 1",ID1) THEN io.WriteString ('AddKey() failed\n'); HALT(20) END;
IF ~hot.AddKey ("alt 2",ID2) THEN io.WriteString ('AddKey() failed\n'); HALT(20) END;
hot.Activate (TRUE);
io.WriteString ('Press Alt-1 or Alt-2\nBreak with Ctrl-C, or ExChange or call me again!\n');
LOOP
ls := e.Wait (LONGSET{HotSig,d.ctrlC});
IF d.ctrlC IN ls THEN io.WriteString ('Break detected!\n'); EXIT END;
IF HotSig IN ls THEN
WHILE hot.GetCMsg(Type,ID) DO
IF hot.command IN Type THEN
CASE ID OF
hot.cAppear : io.WriteString ('ShowInterface\n')|
hot.cDisappear: io.WriteString ('HideInterface\n')|
hot.cKill : io.WriteString('Ciao!\n'); HALT(0)|
hot.cUnique: io.WriteString('Not Uniq. I better quit\n'); HALT(0)|
ELSE
END;
ELSIF hot.hotkey IN Type THEN
CASE ID OF
ID1 : io.WriteString ('Alt 1 pressed!\n')|
ID2 : io.WriteString ('Alt 2 pressed!\n')|
ELSE
END;
END;
END;
END;
END
END HotKeyTest.